<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>

    <style>
        body {
            background: yellow;
        }

        * {
            padding: 0;
            margin: 0;
            box-sizing: border-box;
        }

        .book {
            position: relative;
            transform-style: preserve-3d;
            width: 200px;
            height: 300px;
            margin: 200px auto;
            background-color: #fff8f8;
        }

        #page1,
        #page2,
        #page3,
        #page4 {
            position: absolute;
            transform-style: preserve-3d;
            transition: 2s;
            transform-origin: left;
            left: 0;
            top: 0;

        }

        #page1 {
            z-index: 4;
        }

        #page2 {
            z-index: 3;
        }

        #page3 {
            z-index: 2;
        }

        #page4 {
            z-index: 1;
        }

        .after {
            width: 200px;
            height: 300px;
            background-color: #7e7e7e;
            border: 10px snow solid;
            position: absolute;
            left: 0;
            top: 0;
        }

        .before {
            width: 200px;
            height: 300px;
            background-color: #f8b0b0;
            border: 10px snow solid;
            position: absolute;
            left: 0;
            top: 0;
            backface-visibility: hidden;
            /* 面向屏幕时隐藏 */
        }
    </style>
</head>

<body>
    <div class="book">

        <div id="page1">
            <div class="after"></div>
            <div class="before">111</div>
        </div>
        <div id="page2">
            <div class="after"></div>
            <div class="before">222</div>
        </div>
        <div id="page3">
            <div class="after"></div>
            <div class="before">333</div>
        </div>
        <div id="page4">
            <div class="after"></div>
            <div class="before">444</div>
        </div>

    </div>
    <script>

        let page = 0;
        const oPage = document.querySelectorAll("[id^='page']")
        const oBook = document.querySelector('.book')

        oBook.onclick = () => {
            oPage[page].style.transition = '2s'
            oPage[page].style.transform = 'rotateY(-135deg)'
            page++
            if (page === oPage.length - 1) {

                back()

            }
        }

        function back() {
            if (page === 0) {
                return
            }
            page--
            setTimeout(() => {
                oPage[page].style.transform = 'rotateY(0deg)'
                back()
            }, 1400);
        }

    </script>
</body>

</html>